import * as React from "react";
import style from "./style.less";
import Checkbox from "../../components/Checkbox";
import { ISku } from "../../types";

interface Props {
  sku: ISku;
  value: boolean;
  onChange: (value: boolean, index?:number) => void;
  index?: number;
}

export default class ShopCarItem extends React.Component<Props> {
  render() {
    return (
      <div className={style.caritem}>
        <Checkbox
          value={this.props.value}
          onChange={this.props.onChange}
          index={this.props.index}
        />
        <img className={style.img} src={this.props.sku.cover} />
        <div className={style.text}>
          <p className={style.title}>{this.props.sku.title}</p>
          <p className={style.price}>￥{this.props.sku.price}</p>
        </div>
      </div>
    );
  }
}
